<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">

</div>
<script>
  const data = {
    msg: 'hello',
    count: 0
  }
  const vm = new Proxy(data, {
    get(target, key) {
      console.log(`get, key: `, key, target[key])
      return target[key]
    },
    set(target, key, newValue) {
      console.log(`set, key: `, key, newValue)
      if (target[key] === newValue) {
        return
      }
      target[key] = newValue
      document.getElementById('app').textContent = data[key];
    }
  })
  vm.msg = 'hello world'
  console.log(vm);
</script>
</body>
</html>